/*
 * @Author: lbb
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 */
const ENV = process.env.NODE_ENV || 'development'

// 子应用 身份认证管理

const configFiles = require.context('./modules', false, /\.js$/)

const modules = configFiles.keys().reduce((modules, path, index) => {
  const name = path.replace(/^\.\/(.*)\.\w+$/, '$1')
  const value = configFiles(path)
  // const { entry } = value.default[ENV]
  const { activeRule, container } = value.default
  // 配合部署 将entry 提取至 public/config 文件中
  const { entry } = public_config.micro_config[name][ENV]
  modules[index] = {
    name,
    entry,
    container,
    activeRule
  }
  return modules
}, [])

export default modules
